﻿<%@ page language="C#" autoeventwireup="true" codebehind="TemplateManager.aspx.cs"
  inherits="fbasync.web.TemplateManager" async="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title>Template Manager</title>
  <link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
  <form id="form1" runat="server">
  <div>
    <table>
      <tr>
        <td>
          API Key
        </td>
        <td>
          <asp:textbox runat="server" id="uiApiKey"></asp:textbox>
        </td>
      </tr>
      <tr>
        <td>
          Secret
        </td>
        <td>
          <asp:textbox runat="server" id="uiSecret"></asp:textbox>
        </td>
      </tr>
    </table>
    <asp:linkbutton id="uiAdd" runat="server" text="Add Template"></asp:linkbutton>
    <asp:multiview runat="server" id="uiViews" activeviewindex="0">
      <asp:view runat="server">
        <table>
          <tr>
            <th>
              ID
            </th>
            <th>
              Created
            </th>
            <th>
              Template
            </th>
            <th>
              Template Data
            </th>
          </tr>
          <asp:repeater runat="server" id="uiTopRepeat">
            <itemtemplate>
              <tr>
                <td rowspan="3">
                  <asp:linkbutton runat="server" id="uiEditBundle" text='<%#Eval("ID") %>' commandname="edit"
                    commandargument='<%#Eval("ID") %>' enabled="false"></asp:linkbutton><br />
                  <asp:linkbutton runat="server" id="uiDeleteBundle" text="(delete)" commandname="delete"
                    commandargument='<%#Eval("ID") %>'></asp:linkbutton>
                </td>
                <td rowspan="3">
                  <%#((DateTime)Eval("Created")).ToLocalTime() %>
                </td>
                <td>
                  One Line Templates
                </td>
                <td>
                  <asp:repeater runat="server" id="uiOneLineRepeat">
                    <itemtemplate>
                      <%# HttpUtility.HtmlEncode((Eval("template_title") ?? "").ToString()) %>
                    </itemtemplate>
                    <separatortemplate><br /></separatortemplate>
                  </asp:repeater>
                </td>
              </tr>
              <tr>
                <td>
                  Short Story Templates
                </td>
                <td>
                  <table>
                    <asp:repeater runat="server" id="uiShortRepeat">
                      <itemtemplate>
                        <tr>
                          <td>
                            Title
                          </td>
                          <td>
                            <%# HttpUtility.HtmlEncode((Eval("template_title") ?? "").ToString()) %>
                          </td>
                        </tr>
                        <tr>
                          <td>
                            Body
                          </td>
                          <td>
                            <%# HttpUtility.HtmlEncode((Eval("template_body") ?? "").ToString()) %>
                          </td>
                        </tr>
                      </itemtemplate>
                    </asp:repeater>
                  </table>
                </td>
              </tr>
              <tr>
                <td>
                  Full Story Template
                </td>
                <td>
                  <table>
                    <tr>
                      <td>
                        Title
                      </td>
                      <td>
                        <%# HttpUtility.HtmlEncode((Eval("FullStory.template_title") ?? "").ToString()) %>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        Body
                      </td>
                      <td>
                        <%# HttpUtility.HtmlEncode((Eval("FullStory.template_body") ?? "").ToString()) %>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </itemtemplate>
          </asp:repeater>
        </table>
      </asp:view>
      <asp:view runat="server">
        <asp:formview runat="server" id="uiEditForm" defaultmode="Edit">
          <edititemtemplate>
            <table>
              <tr>
                <th>
                  ID
                </th>
                <th>
                  Created
                </th>
                <th>
                  Template
                </th>
                <th>
                  Template Data
                </th>
              </tr>
              <tr>
                <td rowspan="3">
                  <%#Eval("ID") %>
                </td>
                <td rowspan="3">
                  <%#((DateTime)Eval("Created")).ToLocalTime()%>
                </td>
                <td>
                  One Line Templates
                </td>
                <td>
                  <asp:textbox textmode="MultiLine" runat="server" id="uiOneLiners"></asp:textbox>
                </td>
              </tr>
              <tr>
                <td>
                  Short Story Templates
                </td>
                <td>
                  <table>
                    <asp:repeater runat="server" id="uiShortRepeat">
                      <itemtemplate>
                        <tr>
                          <td>
                            Title
                          </td>
                          <td>
                            <%# HttpUtility.HtmlEncode((Eval("template_title") ?? "").ToString()) %>
                          </td>
                        </tr>
                        <tr>
                          <td>
                            Body
                          </td>
                          <td>
                            <%# HttpUtility.HtmlEncode((Eval("template_body") ?? "").ToString()) %>
                          </td>
                        </tr>
                      </itemtemplate>
                    </asp:repeater>
                  </table>
                </td>
              </tr>
              <tr>
                <td>
                  Full Story Template
                </td>
                <td>
                  <table>
                    <tr>
                      <td>
                        Title
                      </td>
                      <td>
                        <asp:textbox runat="server" id="uiFullStoryTitle" text='<%# HttpUtility.HtmlEncode((Eval("FullStory.template_title") ?? "").ToString()) %>'></asp:textbox>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        Body
                      </td>
                      <td>
                        <asp:textbox runat="server" id="uiFullStoryBody" textmode="MultiLine" text='<%# HttpUtility.HtmlEncode((Eval("FullStory.template_body") ?? "").ToString()) %>'></asp:textbox>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <asp:linkbutton id="uiSave" runat="server" commandname="save" commandargument='<%#Eval("ID") %>' text="Save"></asp:linkbutton>&nbsp;&nbsp;
            <asp:linkbutton id="uiCancel" runat="server" commandname="cancel" commandargument='<%#Eval("ID") %>' text="Cancel"></asp:linkbutton>
          </edititemtemplate>
        </asp:formview>
      </asp:view>
    </asp:multiview>
  </div>
  </form>
</body>
</html>
